// 20/04/2009 Bagdat
class AlbumForm extends Form
{
  ListBox listbox;
  // 20/04/2009 Bagdat
  public AlbumForm()
  {
    // Create listbox
    listbox = new ListBox();
    listbox.noHeader = true;
    listbox.font = font2;
    listbox.fontsize = 24;
    listbox.x = 0;
    listbox.y = 0;
    listbox.width = width;
    listbox.height = height;
    addControl(listbox);
    title = "Select an album";
  }
  
  // 20/04/2009 Bagdat
  public void processEvent(Control c)
  {
    if(c == listbox)
    {
      String lbl = (String)listbox.getSelection().labels.get(0);
      label = lbl;
      db.qryAlbum = db.getAlbum(lbl);
      app.addForm(app.tracksForm);
    }
  }
  
  // 20/04/2009 Bagdat
  public void setActive()
  {
    listbox.scrollpos = 0;
    listbox.items.clear();
    ListBoxItem lbi = new ListBoxItem();
    lbi.labels.add("All Albums");
    listbox.items.add(lbi);
    ArrayList albums = db.queryAlbums();
    Iterator i = albums.iterator();
    while(i.hasNext()){
      Album album = (Album)i.next();
      lbi = new ListBoxItem();
      lbi.labels.add(album.name);
      listbox.items.add(lbi);
    }
  }
}
